package com.ram.service.impl;

import com.ram.mapper.AssetAttachmentMapper;
import com.ram.pojo.AssetAttachment;
import com.ram.service.AssetAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class AssetAttachmentServiceImpl implements AssetAttachmentService {
    @Autowired
    private AssetAttachmentMapper attachmentMapper;

    @Override
    public List<AssetAttachment> list(Integer assetId) {
        return attachmentMapper.list(assetId);
    }

    @Override
    public AssetAttachment getById(Integer id) {
        return attachmentMapper.getById(id);
    }

    @Override
    public void add(AssetAttachment attachment) {
        attachment.setCreateTime(LocalDateTime.now());
        attachmentMapper.insert(attachment);
    }

    @Override
    public void deleteById(Integer id) {
        attachmentMapper.deleteById(id);
    }
} 